package faw.car.ccentersdk.prop;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Arrays;

/**
 * @Author zhuima
 */
public class HQParamConfig implements Parcelable {

    /**
     * 参数名
     */
    private String paraName;

    /**
     * 是否支持该参数
     */
    private boolean isSupport;

    /**
     * 参数类型
     */
    private int paramType;

    /**
     * 值类型
     */
    private int valueType;

    /**
     * 最小值
     */
    private int minValue;

    /**
     * 最大值
     */
    private int maxValue;

    /**
     * 枚举值列表
     */
    private int[] enumValues;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.paraName);
        dest.writeByte(this.isSupport ? (byte) 1 : (byte) 0);
        dest.writeInt(this.paramType);
        dest.writeInt(this.valueType);
        dest.writeInt(this.minValue);
        dest.writeInt(this.maxValue);
        dest.writeIntArray(this.enumValues);
    }

    public HQParamConfig() {
    }

    protected HQParamConfig(Parcel in) {
        this.paraName = in.readString();
        this.isSupport = in.readByte() != 0;
        this.paramType = in.readInt();
        this.valueType = in.readInt();
        this.minValue = in.readInt();
        this.maxValue = in.readInt();
        this.enumValues = in.createIntArray();
    }

    public static final Creator<HQParamConfig> CREATOR = new Creator<HQParamConfig>() {
        @Override
        public HQParamConfig createFromParcel(Parcel source) {
            return new HQParamConfig(source);
        }

        @Override
        public HQParamConfig[] newArray(int size) {
            return new HQParamConfig[size];
        }
    };

    public String getParaName() {
        return paraName;
    }

    public void setParaName(String paraName) {
        this.paraName = paraName;
    }

    public boolean isSupport() {
        return isSupport;
    }

    public void setSupport(boolean support) {
        isSupport = support;
    }

    public int getParamType() {
        return paramType;
    }

    public void setParamType(int paramType) {
        this.paramType = paramType;
    }

    public int getValueType() {
        return valueType;
    }

    public void setValueType(int valueType) {
        this.valueType = valueType;
    }

    public int getMinValue() {
        return minValue;
    }

    public void setMinValue(int minValue) {
        this.minValue = minValue;
    }

    public int getMaxValue() {
        return maxValue;
    }

    public void setMaxValue(int maxValue) {
        this.maxValue = maxValue;
    }

    public int[] getEnumValues() {
        return enumValues;
    }

    public void setEnumValues(int[] enumValues) {
        this.enumValues = enumValues;
    }

    @Override
    public String toString() {
        return "HQParamConfig{" +
                "paraName='" + paraName + '\'' +
                ", isSupport=" + isSupport +
                ", paramType=" + paramType +
                ", valueType=" + valueType +
                ", minValue=" + minValue +
                ", maxValue=" + maxValue +
                ", enumValues=" + Arrays.toString(enumValues) +
                '}';
    }
}
